package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;


public class PingLunShangJiaTask extends CouponHttpBaseTask {

    private String mBusinessid;
    private String mScore;
    private String mContents;


    public PingLunShangJiaTask(String businessId, String commentContent, String score) {
        super(TaskType.PINGLUNSHANGJIA_TASK);
        mBusinessid = businessId;
        mContents = commentContent;
        mScore = score;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest(RequestType.PINGLUNSHANGJIA_REQUEST);
            JSONObject json = new JSONObject();
            json.put("businessId", mBusinessid);
            json.put("commentContent", mContents);
            json.put("score", mScore);
            request.setData(json.toString());
            request.setApiNo(ApiNo.PINGLUNSHANGJIA);
            addRequest(request);
        }
    }


}
